unit ConfigMonGen;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TfrmConfigMonGen = class(TForm)
    ListBoxMonGen: TListBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Edit8: TEdit;
    Edit9: TEdit;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    procedure ListBoxMonGenClick(Sender: TObject);
  private
    { Private declarations }
  public
    procedure Open();
    { Public declarations }
  end;

var
  frmConfigMonGen           : TfrmConfigMonGen;

implementation

uses UsrEngn, M2Share, Envir, Grobal2;

{$R *.dfm}

{ TfrmConfigMonGen }

procedure TfrmConfigMonGen.ListBoxMonGenClick(Sender: TObject);
var
  nSelIndex: Integer;
  MonGen: pTMonGenInfo;
begin
  nSelIndex := TListBox(Sender).itemIndex;
  if nSelIndex < 0 then exit;
  if nSelIndex >= UserEngine.m_MonGenList.Count then exit;
  MonGen := UserEngine.m_MonGenList.Items[nSelIndex];
  Edit1.Text := MonGen.sMapName;
  Edit2.Text := IntToStr(MonGen.nX);
  Edit3.Text := IntToStr(MonGen.nY);
  Edit4.Text := MonGen.sMonName;
  Edit5.Text := IntToStr(MonGen.nRange);
  Edit6.Text := IntToStr(MonGen.nCount);
  Edit7.Text := IntToStr(MonGen.dwZenTime div 60 div 1000);
  Edit8.Text := IntToStr(MonGen.nMissionGenRate);
  Edit9.Text := IntToStr(MonGen.btNameColor);
end;

procedure TfrmConfigMonGen.Open;
var
  i                         : Integer;
  MonGen                    : pTMonGenInfo;
begin
  for i := 0 to UserEngine.m_MonGenList.Count - 1 do begin
    MonGen := UserEngine.m_MonGenList.Items[i];
//    if Mongen.sMonName = '' then Continue;
    ListBoxMonGen.Items.AddObject(MonGen.sMapName + '(' + IntToStr(MonGen.nX) + ':' + IntToStr(MonGen.nY) + ')' + ' - ' + MonGen.sMonName, TObject(MonGen));
  end;
  ShowModal;
end;

end.
